package com.proxy.cglib;

import com.proxy.ISubject;
import com.proxy.Subject;
import net.sf.cglib.proxy.Enhancer;

/**
 * 每一行代码，都是改变世界的力量
 *
 * @author 郭帅
 * @date 2022/11/17 14:23
 */
public class Main {


    /**
     * cglib 动态代理模式
     */
    public static void main(String[] args) {
        ISubject target = new Subject();
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(Subject.class);
        enhancer.setCallback(new MyInterceptor(target));
        ISubject subject = (ISubject) enhancer.create();
        subject.hello("guoshuai");
    }

}
